package top.wangjingxin.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.wangjingxin.base.Result;
import top.wangjingxin.model.link.LinkDTO;
import top.wangjingxin.service.LinkService;

import javax.servlet.http.HttpServlet;

@RequestMapping("/api/v1/link")
@RestController
public class LinkController {
    @Autowired
    LinkService linkService;

    @GetMapping("get")
    public Result get(int type) {
        return linkService.get(type);
    }

    @PostMapping("delete")
    public Result delete(int id) {
        return linkService.delete(id);
    }

    @PostMapping("add")
    public Result add(LinkDTO linkDTO) {
        return linkService.add(linkDTO);
    }

    @PostMapping("update")
    public Result update(LinkDTO linkDTO) {
        return linkService.update(linkDTO);
    }

    @PostMapping("login")
    public Result login(String id,String password) {
        return linkService.login(id,password);
    }
}
